package leetcode.code033;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public abstract class Solution033 implements IDebug {

	abstract public int search(int[] nums, int target);

	@Override
	public void debug1() {
		String numsStr = "[4,5,6,7,0,1,2]";
		int target = 0;
		int expect = 4;
		this.debug(numsStr, target, expect);
	}

	private void debug(String numsStr, int target, int expect) {
		int[] nums = HelpDebug.str2array3(numsStr);
		int result = this.search(nums, target);
		HelpDebug.compare(expect, result);
	}

	@Override
	public void debug2() {
		String numsStr = "[4,5,6,7,0,1,2]";
		int target = 3;
		int expect = -1;
		this.debug(numsStr, target, expect);
	}

	@Override
	public void debug3() {
		String numsStr = "[1]";
		int target = 0;
		int expect = -1;
		this.debug(numsStr, target, expect);
	}

	@Override
	public void debug4() {
		String numsStr = "[3,5,1]";
		int target = 3;
		int expect = 0;
		this.debug(numsStr, target, expect);
	}

	public void debug5() {
		String numsStr = "[4,5,6,7,0,1,2]";
		int target = 0;
		int expect = 4;
		this.debug(numsStr, target, expect);
	}

}
